<%-- 
    Document   : lessonlist_admin
    Created on : Jul 30, 2013, 2:47:34 PM
    Author     : dienvm60347
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script type="text/javascript">
            function changDisplay(idlink, idtxt){
                if(!document.getElementById(idlink).style.display||document.getElementById(idlink).style.display=="inline-table"){
                    document.getElementById(idlink).style.display="none";
                    document.getElementById(idtxt).style.display="inline-table";
                } else {
                    document.getElementById(idlink).style.display="inline-table";
                    document.getElementById(idtxt).style.display="none";
                }
            }
        </script>
        <title>Admin Page</title>
    </head>
    <body>
        <c:choose>
            <c:when test="${ID=='1' or ID=='2'}">
                <c:set var="id" value="Sơ Cấp"/>
            </c:when>
            <c:otherwise>
                <c:set var="id" value="Trung Cấp"/>
            </c:otherwise>
        </c:choose>
        <div style="margin: auto; width: 990px;">
            <div class="header">
                <c:import url="header.jsp"/>
            </div>
            <div class="content">
                <div class="content_left">
                    <c:choose>
                        <c:when test="${not empty USERNAME}">
                            <c:import url="login-success.jsp">
                                <c:param name="user" value="${USERNAME}"/>
                            </c:import>
                        </c:when>
                        <c:otherwise>
                            <c:import url="loginBox.jsp"/>
                        </c:otherwise>
                    </c:choose>
                </div>
                <div class="content_right">
                    <div class="title">
                        <div class="title_left">
                            ${id}
                        </div>
                        <div class="subtitle">
                        </div>
                    </div>
                    <div style="margin: 20px;">
                        <c:if test="${VALID=='false'}">
                            <script>alert("Tên bài không hợp lệ!!!")</script>
                        </c:if>
                        <table class="listlesson_table" cellspacing="0" width="100%">
                            <thead>
                                <tr style="background-color: #5196ee">
                                    <th>Tên tài liệu</th>
                                    <th></th>
                                </tr>
                            </thead>
                            <tbody>
                                <c:if test="${not empty LISTLESSON}">
                                    <c:forEach var="list" items="${LISTLESSON}" varStatus="counter">
                                        <tr>
                                            <c:choose>
                                                <c:when test="${ID=='2'}">
                                            <form action="ControllerServlet">
                                                <td style="width: 630px">
                                                    <a id="${counter.count}" class="lesson" href="minna.jsp?lessonId=${list.lessonId}">${list.lessonName}</a>
                                                    <input id="N${counter.count}" class="txtEditLesson" type="text" name="txtLessonName" value="${list.lessonName}"/>
                                                    <input type="hidden" name="txtLessonID" value="${list.lessonId}" />
                                                    <input type="hidden" name="txtOptionID" value="${ID}" />
                                                    <input type="hidden" name="txtType" value="${TYPE}" />
                                                </td>
                                                <td id="img_button_lessonlist">
                                                    <a onclick="changDisplay('${counter.count}', 'N${counter.count}');
                                                        changDisplay('IE${counter.count}', 'UB${counter.count}');
                                                        changDisplay('ID${counter.count}', 'CB${counter.count}');">
                                                        <img id="IE${counter.count}" alt="edit"  src="./Images/imgEditbuton.png" title="Chỉnh sửa.."/>
                                                    </a>
                                                    <a>
                                                        <img id="ID${counter.count}" alt="delete"  src="./Images/imgDeletebuton.png" title="Xóa.."/>
                                                    </a>
                                                    <input id="UB${counter.count}" class="bt_lessionList" type="submit" value="Cập nhật" name="action" />
                                                    <input id="CB${counter.count}" class="bt_lessionList" type="button" value="Thoát"
                                                           onclick="changDisplay('${counter.count}', 'N${counter.count}');
                                                               changDisplay('IE${counter.count}', 'UB${counter.count}');
                                                               changDisplay('ID${counter.count}', 'CB${counter.count}');"/>
                                                </td>
                                            </form>
                                        </c:when>
                                        <c:otherwise>
                                            <form action="ControllerServlet">
                                                <td style="width: 630px">
                                                    <a id="${counter.count}" class="lesson" href="ControllerServlet?action=ldetail&lessonId=${list.lessonId}">${list.lessonName}</a>
                                                    <input id="N${counter.count}" class="txtEditLesson" type="text" name="txtLessonName" value="${list.lessonName}"/>
                                                    <input type="hidden" name="txtLessonID" value="${list.lessonId}" />
                                                    <input type="hidden" name="txtOptionID" value="${ID}" />
                                                    <input type="hidden" name="txtType" value="${TYPE}" />
                                                </td>
                                                <td id="img_button_lessonlist">
                                                    <a onclick="changDisplay('${counter.count}', 'N${counter.count}');
                                                        changDisplay('IE${counter.count}', 'UB${counter.count}');
                                                        changDisplay('ID${counter.count}', 'CB${counter.count}');">
                                                        <img id="IE${counter.count}" alt="edit"  src="./Images/imgEditbuton.png" title="Chỉnh sửa.."/>
                                                    </a>
                                                    <a>
                                                        <img id="ID${counter.count}" alt="delete"  src="./Images/imgDeletebuton.png" title="Xóa.."/>
                                                    </a>
                                                    <input id="UB${counter.count}" class="bt_lessionList" type="submit" value="Cập nhật" name="action" />
                                                    <input id="CB${counter.count}" class="bt_lessionList" type="button" value="Thoát"
                                                           onclick="changDisplay('${counter.count}', 'N${counter.count}');
                                                               changDisplay('IE${counter.count}', 'UB${counter.count}');
                                                               changDisplay('ID${counter.count}', 'CB${counter.count}');"/>
                                                </td>
                                            </form>
                                        </c:otherwise>
                                    </c:choose>

                                    </tr>
                                </c:forEach>
                            </c:if>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <div class="foot-wrap">
            Assignment - Group Điền Nam Ngọc<br/>
            FPT - University
        </div>
    </body>
</html>
